# no graphics here 'cos it has to get loaded before graphics are set up

from general_utilities import *

class config:
  entries = {}
  
  def __init__(self,filename):
    try:
      file = open(filename,"r")
    except:
      return # no config loaded, everything will revert to defaults
    for line in file:
      line = line.strip()
      if len(line)>0:
        if line[0]<>"#" and line.find("=")>=0:
          # valid line
          key = line[:line.find("=")]
          entry = line[line.find("=")+1:]
          self.entries[key] = entry

  def get(self,key,default):
    if key in self.entries:
      return self.entries[key]
    else:
      return default
    
    
